package com.coolingme.general;

/**
 * 访问者模式测试
 *
 * @author wangyue
 * @date 2020-10-09 23:10
 */
public class Test {

    public static void main(String[] args) {
        // 结构对象,初始化元素至容器中
        ObjectStructure objectStructure = new ObjectStructure();

        // 访问者A
        ConcreteVisitorA concreteVisitorA = new ConcreteVisitorA();
        objectStructure.accept(concreteVisitorA);
        System.out.println("-------------");

        // 访问者B
        ConcreteVisitorB concreteVisitorB = new ConcreteVisitorB();
        objectStructure.accept(concreteVisitorB);

    }

}
